package com.yl.order.ui.dialog;

import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.yl.common.ui.BaseDialogFragment;
import com.yl.order.R;


/**
 * create by cjx on 2024/5/13
 * desc:
 */
public class LoadingDialogFragment extends BaseDialogFragment {
    private String title;
    private TextView titleView;

    public static LoadingDialogFragment newInstance() {
        return new LoadingDialogFragment();
    }

    @Override
    public int getViewId() {
        return R.layout.dialog_loading;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        titleView = findViewById(R.id.loading_title);
        titleView.setText(title);
        if(getDialog() != null){
            getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        }

    }

    @Override
    public void onStart() {
        super.onStart();
    }

    public LoadingDialogFragment setTitle(String title) {
        if(titleView != null){
            titleView.setText(title);
            return this;
        }
        this.title = title;
        return this;
    }

    @Override
    public void dismiss() {
        super.dismiss();
    }

}
